home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d26 / corwp30.arc / COREMAN.DOC < prev    next >
Text File  |  1991-11-19  |  67KB  |  1,251 lines

  1.  
  2.  
  3.         ┌────────────────────────────────────────────────────────╖
  4.         │ ┌──╖┌──╖┌─╖ ┌──╖┌┬┬╖┌──╖┌─╖   ┌──╖┌─╖ ┌──╖  ┌──╖  ┌──╖ ║██
  5.         │ │╔═╝│╔╕║│║╙╖│ ═╣│││║│══║│║╙╖  │══║│║╙╖│╔╕║  ├─ ║  │╔╕║ ║██
  6.         │ │╙─╖│╙┘║│╔╕║│ ═╣│  ║│╔╕║│╔╕║  │╔═╝│╔╕║│╙┘║  ├─ ║┌╖│╙┘║ ║██
  7.         │ ╘══╝╘══╝╘╝╘╝╘══╝╘══╝╘╝╘╝╘╝╘╝  ╘╝  ╘╝╘╝╘══╝  ╘══╝╘╝╘══╝ ║██
  8.         │       ┌╖┌╖┌──╖┌──╖┌─╖   ┌──╖┌──╖┌─┬╖┌╖┌╖┌──╖┌╖         ║██
  9.         │       │║│║│ ═╣│ ═╣│║╙╖  │  ║│══║│ │║│║│║│══║│║         ║██
  10.         │       │╙┘║├─ ║│ ═╣│╔╕║  │║║║│╔╕║│║ ║│╙┘║│╔╕║│╙─╖       ║██
  11.         │       ╘══╝╘══╝╘══╝╘╝╘╝  ╘╩╩╝╘╝╘╝╘╩═╝╘══╝╘╝╘╝╘══╝       ║██
  12.         ╘════════════════════════════════════════════════════════╝██
  13.           ██████████████████████████████████████████████████████████
  14.  
  15.  
  16.                         Copyright (c) 1991 Stefan Strack
  17.                         All rights reserved
  18.  
  19.                 Email:  stracks@vuctrvax (Bitnet)
  20.                         stracks@ctrvax.vanderbilt.edu (Internet)
  21.                 Mail:   Dept. Pharmacology, 406 MRB
  22.                         Vanderbilt Univ. Medical School
  23.                         Nashville, TN 37232-6600
  24.                 Phone: +615-322-4890, Fax: +615-343-6532
  25.  
  26.  
  27.         ┌────────────────────╖
  28.         │ Table of Contents  ║
  29.         ╘════════════════════╝
  30.                                                                  Line
  31.          1. Files ..............................................   59
  32.          2. Introduction .......................................   72
  33.          3. Hardware requirements ..............................   93
  34.          4. Configuration ......................................  105
  35.          5. Menu options........................................  294
  36.                  5.1. Function keys ............................  311
  37.                  5.2. Top level menu ...........................  344
  38.                  5.3. The Loader menu ..........................  365
  39.                  5.4. The Monitor menu .........................  424
  40.          6. Redcode ............................................  457
  41.                  6.1. Instruction set ..........................  496
  42.                  6.2. Addressing modes .........................  716
  43.                  6.3. Preprocessor syntax ......................  760
  44.          7. ICWS'88 extensions .................................  931
  45.                  7.1. Process limit ............................  953
  46.                  7.2. Address space ............................  969
  47.                  7.3. Descendant count .........................  983
  48.          8. The Core Editor .................................... 1013
  49.          9. Run control switches ............................... 1099
  50.         10. Bugs ............................................... 1199
  51.         11. Version history .................................... 1218
  52.  
  53.         This document contains graphics characters; make sure your printer
  54.         is set up properly before printing.
  55.  
  56. V3.0=>  New features or changes in Version 3.0 are marked at the left margin.
  57.  
  58.  
  59.         ┌────────────╖
  60.         │  1. Files  ║
  61.         ╘════════════╝
  62.  
  63.         CORE.DOC    - Quick intro, what's new
  64.         COREMAN.DOC - Manual for CoreWar Pro
  65.         CORE.EXE    - CoreWar Pro executable
  66.         CORE.SYS    - Configuration file for CORE.EXE
  67.         CORESTD.SYS - Configuration file for ICWS'88 compatible battles
  68.         COREMUS.DEF - optional mouse driver
  69.         *.RED       - sample Redcode programs
  70.  
  71.  
  72.         ┌───────────────────╖
  73.         │  2. Introduction  ║
  74.         ╘═══════════════════╝
  75.  
  76.         Core War is a simulation game for program battles in a small virtual
  77.         memory space. The rules are detailed in the original articles by the
  78.         creator of Core War, A.K.Dewdney (Computer recreations column,
  79.         Scientific American, May 84, March 85, December(?) 86; compiled in
  80.         his book "The Armchair Universe"). CoreWar Pro is a MARS (Memory
  81.         Array Redcode Simulator), a Core War supervisory program that
  82.         schedules the execution of battle programs written in the
  83.         assembly-style language Redcode. CoreWar Pro is an integrated
  84.         environment for writing and debugging Redcode programs and for
  85.         running battles between two or more programs. The Redcode interpreter
  86.         supports a superset of the ICWS'88 (International Core War Standard
  87.         of 1988) instruction set (see  6.) and implements Jon Newman's 
  88.         Three Proposals for Future Redcode Standards (see  7.).
  89.  
  90. V3.0=>  The program is written in PDC Prolog 3.21.
  91.  
  92.  
  93.         ┌────────────────────────────╖
  94.         │  3. Hardware Requirements  ║
  95.         ╘════════════════════════════╝
  96.  
  97.         CoreWar Pro runs under DOS on IBM compatible computers with floppy or
  98.         hard drive and DOS. A graphics card is not required, since the
  99.         program operates fully in text mode. Memory requirement depends on
  100.         the size of the Core (specified in CORE.SYS, default 8000) and on the
  101.         number of Redcode programs loaded. With a Core size of 8000 the
  102.         program will need less than 300K. The maximum Core size is 32757.
  103.  
  104.  
  105.         ┌────────────────────╖
  106.         │  4. Configuration  ║
  107.         ╘════════════════════╝
  108.  
  109.         The program is started with
  110.  
  111.         CORE [filename]
  112.  
  113.         where the optional parameter "filename" specifies a configuration
  114.         file. If omitted, the file defaults to CORE.SYS.
  115.  
  116.         The configuration file controls appearance and behavior of CoreWar
  117.         Pro. It consists of Prolog predicates that are consulted upon program
  118.         start. You can change the setup by modifying the file with a text
  119.         editor. All predicates are on a separate line, no blank lines are
  120.         permitted. Commenting text following the closing parenthesis of a
  121.         predicate is ignored. The CORE.SYS supplied with this release is a
  122.         sample configuration for a color display; there you can find examples
  123.         for most predicates described in the following.
  124.  
  125.         If CoreWar Pro cannot find the configuration file, or predicates are
  126.         omitted from the file, the program will initialize from defaults.
  127.  
  128.         predicate: coresize(CS)
  129.                 occurs: 0..1
  130.                 argument: CS = 0..32757, default = 8000
  131.                 example: coresize(32000)
  132.  
  133.         Coresize/1 determines the size of the virtual memory array (Core) in
  134.         number of addresses; the original rules refer to CS=8000, but for
  135.         Redcode debugging and test runs the Core can be much smaller. The
  136.         Core may contain up to 32757 addresses. The larger the Core array,
  137.         the longer before a battle concludes by extinction of a contestant.
  138.  
  139. V3.0=>  address_space(AS)
  140.                 occurs: 0..1
  141.                 argument: AS = 0..CoreSize, default = CoreSize
  142.                 example: address_space(2000)
  143.  
  144.         Address_space/1 specifies the range of Core that is addressable from
  145.         a given instruction (see  7.2.). Numeric fields of instructions
  146.         are normalized to a range of -(AS/2) .. (AS/2)-1 (-1000 .. 999 in the
  147.         example). The entire Core is addressable by default (AS=CoreSize).
  148.  
  149. V3.0=>  process_limit(PL)
  150.                 occurs: 0..1
  151.                 argument: PL = 1..32767, default = 1000
  152.                 example: process_limit(64)
  153.  
  154.         Process_limit/1 restricts the maximum number of processes allocated
  155.         to each program (see  7.1.). When the process number reaches
  156.         this limit, SPL will have the effect of a "JMP 1" instruction.
  157.  
  158.  
  159. V3.0=>  descendant_count(Switch)
  160.                 occurs: 0..1
  161.                 argument: Switch = on ; off, default = on
  162.                 example: descendant_count(off)
  163.  
  164.         Descendant_count/1 specifies how the B-field of the SPL (Split)
  165.         instruction is interpreted. If Switch=on, the B-field is taken to be
  166.         the "descendant count", i.e. the maximum number of children,
  167.         children's children etc. of the currently executing process (see
  168.          7.3.).  An empty B-field is translated to "#32767" which amounts
  169.         to quasi-unbounded process spawning. If Switch=off, the B-field is
  170.         ignored in compliance with ICWS'88.
  171.  
  172.         The value of this predicate has side-effects on behavior of the
  173.         non-standard stack- (PSH, POP, GSB, RET, SSZ) and process-control
  174.         instructions (SSP, RLS): If Switch=on, each SPL execution will create
  175.         a process-node with a unique process ID-number. Since the interpreter
  176.         assigns a private stack and a "suspended-process buffer" to each
  177.         process ID-number, these instruction will have effects local to the
  178.         executing process. With descendant_count disabled, no descendant tree
  179.         is built, and each process has an ID-number equal to the program-ID.
  180.         Consequently, one stack and one suspended-process buffer is shared
  181.         among all processes of a given program (see  6.1.,  7.3.).
  182.  
  183. V3.0=>  predicate: screensize(Rows,Columns)
  184.                 occurs: 0..1
  185.                 arguments: Rows: 25, 43, 50, 60 ..
  186.                            Columns: 80, 132, ..
  187.                 example: screensize(50,80)
  188.  
  189.         By default, CoreWar Pro starts up using the current text mode for
  190.         displaying the Core arena (most commonly 25 rows by 80 columns). The
  191.         screensize/2 predicate is used to set the screen size to the
  192.         specified values. You need to have the appropriate graphics card to
  193.         use extended text modes (EGA for 43x80, VGA for 50x80, etc.).
  194.  
  195.         predicate: windowcolors(WindowName,InsideColor,FrameColor)
  196.                 occurs: 0..7
  197.                 arguments: WindowName = main ; menu ; statusline ; dialog ;
  198.                                         message ; editor ; error
  199.                            InsideColor = 0..255, default = 7 (statusline 122)
  200.                            FrameColor = 0..255, default = 15
  201.                 example:   windowcolors(message,36,47)
  202.  
  203.         This predicate specifies the appearance of several windows (main,
  204.         menu, ..) in the game environment. InsideColor and FrameColor are
  205.         integers in the range from 0 to 255 specifying the color of the
  206.         window inside and its frame respectively. If you have a monochrome
  207.         monitor and the Core War display is illegible using the provided
  208.         CORE.SYS, try color values 7 or 15. You can also delete all
  209.         windowcolors/3 predicates, since colors default to black and white.
  210.  
  211. V3.0=>  predicate: controlmode(M1,M2,M3,M4,M5,M6,M7,M8,M9)
  212.                 occurs: 0..1
  213.                 arguments: M1,M2,..M8 = on ; off
  214.                 defaults: (on,off,on,off,on,on,on,off,off)
  215.                 example: controlmode(off,on,off,off,off,off,off,off,off)
  216.  
  217.         Controlmode/9 describes the initial setting of run control and run
  218.         display parameters (see  9.). The order of arguments is the
  219.         same as in the "Run control" window.
  220.  
  221.         predicate: prodisplay(ProcessNo,ExeColor,ExeChar,
  222.                                         WriteColor,WriteChar,
  223.                                         BreakColor,BreakChar)
  224.                 occurs: 0..?
  225.                 arguments: ProgramNo = 1..?
  226.                            ExeColor = 0..255, default = MainWindowForeground
  227.                            ExeChar = ASCII(32)..ASCII(255),
  228.                                 default = ASCII(48 + ProgramNo)
  229.                            WriteColor = 0..255,
  230.                                 default = MainWindowForeground
  231.                            WriteChar = ASCII(32)..ASCII(255),
  232.                                 default = ASCII(249) ('∙')
  233.                            BreakColor = 0..255,
  234.                                 default = MainWindowForeground + 128,
  235.                            BreakChar = ASCII(32)..ASCII(255),
  236.                                 default = ASCII(48 + ProgramNo)
  237.                 example:   prodisplay(1,32,'1',2,'█',175,'1')
  238.  
  239.         Prodisplay/7 controls the appearance of processes when run in "visual
  240.         mode" (see  9.). Argument ExeColor is the color attribute for
  241.         the display of ExeChar, the character indicating the execution of
  242.         program ProgramNo. When ProgramNo writes to Core, it is shown by
  243.         displaying WriteChar with color WriteColor. When visual mode is
  244.         interrupted because a program faulted, a key was pressed, etc., the
  245.         address last executed is highlighted by BreakChar displayed with
  246.         color BreakColor.
  247.  
  248.         predicate: exclude(ExStr)
  249.                 occurs: 0..?
  250.                 argument: ExStr   = "DAT" ; "MOV" ; "ADD" ; "SUB" ; "JMP" ;
  251.                                     "JMZ" ; "JMN" ; "JMG" ; "DJZ" ; "DJN" ;
  252.                                     "CMP" ; "SPL" ; "PCT" ; "HLT" ; "GSB" ;
  253.                                     "RET" ; "PSH" ; "POP" ; "RND" ; "SSP" ;
  254.                                     "RLS" ; "EXC" ; "SSZ" ; "SLT" ;
  255.                                     "$" ; "@" ; "<" ; ">" ; "^" ; "/" ; "\"
  256.                 example: exclude("EXC")
  257.  
  258.         The exclude/1 predicate forces programs to use a subset of the
  259.         Redcode language - e.g. to enforce the ICWS'88 instruction set. ExStr
  260.         is a quoted opcode in all capitals or an addressing mode symbol.
  261.  
  262.         predicate: editor(CommandString)
  263.                 occurs: 0..1
  264.                 argument: CommandString = DOS command string
  265.                 example: editor("qed")
  266.  
  267.         Use the editor/1 predicate to specify the file editor invoked by the
  268.         "Editor" selection from the main menu.
  269.  
  270.         predicate: path(DosPathName)
  271.                 occurs: 0..1
  272.                 argument: DosPathName = valid drive:\pathname,
  273.                         default = ""
  274.                 example: path("D:\GAMES\COREWAR")
  275.  
  276.         Path/1 specifies where CoreWar Pro looks for files when displaying a
  277.         directory listing. Files that the program expects in DosPathName are
  278.         programs (*.RED), and saved game states (*.DMP). If the path/1
  279.         predicate is omitted, CoreWar Pro will look for all files in the
  280.         current directory. E.g. path("b:") sets the directory path to drive
  281.         B:. Note: you must omit the trailing back-slash in the directory
  282.         name.
  283.  
  284.         predicate: cycles(N)
  285.                 occurs: 0..1
  286.                 argument: N = Real
  287.                         default: 100000
  288.         example: cycles(2500)
  289.  
  290.         Cycles/1 sets the starting value for the count-down execution timer
  291.         (see also  9.).
  292.  
  293.  
  294.         ┌───────────────────╖
  295.         │  5. Menu options  ║
  296.         ╘═══════════════════╝
  297.  
  298.         CoreWar Pro is a windowing environment driven by menus and dialog
  299.         windows. Menu items are selected with arrow keys and the <Return> key
  300.         or highlighted hot-keys; the escape key returns to the previous menu
  301.         on top and also cancels input in dialog windows. The main window
  302.         displays the progress of the Core battle and the message window
  303.         receives most text output (run information, status reports etc.). The
  304.         status line on the bottom of the screen informs if and what kind of
  305.         input the program will accept. From the top level menu the two
  306.         central modules Loader and Monitor can be selected, each represented
  307.         with its own submenu. Briefly, the Loader loads and installs Redcode
  308.         programs and the Monitor executes them.
  309.  
  310.  
  311.         ┌──────────────────────╖
  312.         │  5.1. Function keys  ║
  313.         ╘══════════════════════╝
  314.  
  315.         You can use the function keys F1 to F6 to execute frequently used 
  316.         commands. F2, F3 and F4 (RunV, Step, Watch) first set the appropriate
  317.         interrupt/view modes of the control panel, then start the interpreter
  318.         and finally reset the control panel to its previous state.
  319.  
  320.         F1      (Load) Lets you select Redcode programs from a directory
  321.         listing until you press <Escape>. You are then prompted for one of
  322.         three ways to install the selected programs in Core (see  5.3.,
  323.         Install programs). This is equivalent to repeatedly selecting "Load
  324.         program" and then "Install programs" from the Loader submenu.
  325.  
  326.         F2      (RunV) Starts the interpreter in visual mode using the
  327.         default settings for controlmode/9.
  328.  
  329.         F3      (Step) Starts the interpreter in single-step (debugging)
  330.         mode.
  331.  
  332.         F4      (Watch) Starts the interpreter in watch/single-step mode.
  333.         Watchpoints are set from within the Core Editor.
  334.  
  335.         F5      (New) Clears the Core and unloads programs (= "Reset"/"Unload
  336.         programs" from the Loader submenu).
  337.  
  338.         F6      (Cls) Clears the main window.
  339.  
  340.                                                         ┌─────────┐
  341.                                                         │Loader▒▒>│
  342.                                                         │Monitor >│
  343.                                                         │DOS      │
  344.         ┌───────────────────────╖                       │Editor   │
  345.         │  5.2. Top level menu  ║                       │Quit     │
  346.         ╘═══════════════════════╝                       └─────────┘
  347.  
  348.         The top level menu provides access to the Loader and Monitor submenus
  349.         and exits the environment (Quit). In addition the following commands
  350.         are available from the main menu:
  351.  
  352.          5.2.1 DOS. This selection starts up a DOS shell. "EXIT" returns
  353.         to the top level.
  354.  
  355.          5.2.2 Editor. Invokes the editor specified in the editor/1 setup
  356.         predicate (see  4.) for editing Redcode programs etc..
  357.  
  358.  
  359.                                                         ┌─────────┐
  360.                                                         │Loader▒▒>│
  361.                                            ┌──────────────────────┐
  362.                                            │Load▒Redcode▒program▒▒│
  363.                                            │Install programs     >│
  364.                                            │Load Core             │
  365.         ┌────────────────────────╖         │Dump Core             │
  366.         │  5.3. The Loader menu  ║         │Reset                >│
  367.         ╘════════════════════════╝         └──────────────────────┘
  368.  
  369.         The Loader submenu is used to make the preparations for a Core battle
  370.         such as loading programs from disk, installing them in Core, etc..
  371.         These are the items on the menu:
  372.  
  373.          5.3.1 Load Redcode program. Reads a Recode source file from
  374.         disk, selected from a directory listing of files matching *.RED and
  375.         assembles the program into an internal representation of Redcode. You
  376. V3.0=>  can change the default file path or extension by pressing F4 (Mask)
  377.         in the directory window. A program is selected using cursor-control
  378.         keys or the first letter of the file name. Syntax errors are reported
  379.         in an error window, and the assembly status is reported after
  380.         completion. "Load Redcode program" can be repeated ad lib.; for each
  381.         successful assembly a new program image is stored in memory. A
  382.         description of Redcode syntax can be found in section  6.
  383.  
  384.          5.3.2 Install programs. After all Redcode battle contestants
  385.         have been loaded from disk and successfully assembled, they need to
  386.         be installed in the circular memory array (Core). "Install programs"
  387.         offers three installation modes in a submenu:
  388.  
  389.         (1) At random. Programs are installed with randomly scattered start
  390.         addresses while maintaining a minimum distance that can be specified.
  391.         (2) Maximum distance. Programs are installed into Core such that they
  392.         keep a maximum distance from one another. (3) Manually. The user is
  393.         prompted for the start address of each program.
  394.  
  395.          5.3.3 Load Core. The Core War simulator allows to dump the
  396.         current state of execution (Core contents, programs, process control
  397.         blocks, process queue, stacks) to disk in order to resume with a
  398.         battle in progress at a later time. "Load Core" lets the user select
  399.         a core file (*.DMP) from a current directory listing and consults
  400.         (=reads) it. Load/Install programs and Load Core are mutually
  401.         exclusive options for preparing for execution.
  402.  
  403.          5.3.4 Dump Core. See above item; dumps the current state of
  404.         execution to disk (default extension .DMP). This option is also
  405.         useful for making "back-ups" during a long-running battle. A .DMP
  406.         file is a plain ASCII-file that you can look at or modify with an
  407.         editor.
  408.  
  409.          5.3.5 Reset. Allows to reset (clear) Core and/or program images
  410.         in order to start fresh. (a) "Uninstall programs" clears all Core
  411.         addresses and resets process control blocks, stacks, and the process
  412.         queue, (b) "Unload programs" does the same as (a) and also clears all
  413.         programs from memory (this corresponds to pressing F5).  (c) "Reset
  414.         counter" resets the count-down execution timer to its start value
  415.         (specified in the configuration file, see  4).  "Install
  416.         programs" will not work unless the Core is clear.
  417.  
  418.  
  419.                                                         ┌─────────┐
  420.                                                         │Loader  >│
  421.                                                         │Monitor▒>│
  422.                                                       ┌───────────┐
  423.                                                       │Run▒▒▒▒▒▒▒▒│
  424.         ┌─────────────────────────╖                   │Control   >│
  425.         │  5.4. The Monitor menu  ║                   │Edit Core  │
  426.         ╘═════════════════════════╝                   └───────────┘
  427.  
  428.         The Monitor is the program scheduler and Redcode interpreter; from
  429.         the Monitor menu you can start execution, control execution, inspect
  430.         or edit the Core contents. The menu entries are:
  431.  
  432.          5.4.1 Run. This starts the round-robin scheduler executing
  433.         instructions of Redcode programs installed in Core. Execution is
  434.         interrupted when one of the interrupt conditions enabled on the
  435.         control panel (see  9.) applies.  An interrupt window displays
  436.         the source of interrupt, the current process' program counter and the
  437.         instruction interrupted. You are then returned to the Monitor menu
  438.         from which execution can be restarted after the point of interrupt.
  439.         The "Run" command uses the current settings on the control panel (see
  440.         below and  9.). The F2-4 keys start execution with predefined
  441.         control settings (see  5.1.).
  442.  
  443.          5.4.2 Control. Opens the "control panel" of the scheduler.
  444.         Several controls pertaining to execution interrupts (single step,
  445.         break on error etc.) and representation of the running processes
  446.         (visual, watch, etc.) can be enabled or disabled by toggling on or
  447.         off. The initial setting of the control parameters are defined by the
  448.         setup predicate controlmode/9 (see  4.). The effect of each
  449.         control parameter on execution is described in section  9.
  450.  
  451.          5.4.3 Edit Core. This option starts the full-screen memory
  452.         editor in its own window. The Core Editor allows you to scroll
  453.         through the memory array and to modify the contents of addresses.
  454.         Core Editor commands are described in section  8.
  455.  
  456.  
  457.         ┌──────────────╖
  458.         │  6. Redcode  ║
  459.         ╘══════════════╝
  460.  
  461.         CoreWar Pro deals with three forms of Redcode as shown in this
  462.         schema:
  463.  
  464.                  "Full Redcode" (program on disk)
  465.                         │
  466.                         │ Preprocessor
  467.                         v
  468.                  "Plain Redcode"
  469.                         ^
  470.                         │ Assembler/Disassembler
  471.                         v
  472.                  "Machine code"
  473.  
  474.         The Redcode programmer writes programs in "Full Redcode" using a text
  475.         editor. Full Redcode is Redcode with "syntactic sugar" (see
  476.          6.3.). In pre-3.0 versions of CoreWar Pro, the preprocessor was
  477.         a separate program (RPP.EXE) that converted Full Redcode files to
  478.         "Plain Redcode" files, ie Redcode with all labels, EQUates and
  479.         expressions resolved to numbers. Starting with version 3.0, the
  480.         preprocessor is integrated into the program loader and feeds Plain
  481.         Redcode directly into the assembler. The assembler in turn produces a
  482.         space-efficient internal representation of the code ("machine code").
  483.         Machine code is not visible to the user; in fact, the Core Editor
  484.         (see  8.) includes a disassembler that translates machine code
  485.         back into human-readable Plain Redcode for display.
  486.  
  487.         Each Redcode instruction occupies one line. Plain Redcode
  488.         instructions consist of a three-letter opcode followed by zero, one
  489.         or two operands. Each operand is made up of an optional addressing
  490.         mode character (see  6.2.) followed by an integer. Each file
  491. V3.0=>  contains exactly one program. Execution starts at the first
  492.         executable (ie non-DAT) instruction unless a specific start
  493.         instruction is defined by an "END <Start>" statement.
  494.  
  495.  
  496.         ┌────────────────────────╖
  497.         │  6.1. Instruction set  ║
  498.         ╘════════════════════════╝
  499.  
  500.         CoreWar Pro supports a superset of the International Core War
  501.         Standard of 1988 (ICWS'88) Redcode instruction set. Twelve of the 25 
  502.         opcodes supported belong to the ICWS'88 (this includes DAT and the 
  503.         END pseudo-opcode). The 13 non-standard opcodes fall into six 
  504.         classes: (1) Opcodes listed by A.K.Dewdney that were never 
  505.         incorporated into the standard (JMG, DJZ); (2) the proposed opcode 
  506.         PCT; (3) the widely implemented, but non-standard RND; (4) additional 
  507.         process-control opcodes (SSP, RLS, HLT), including the two-operand
  508.         version of SPL; (5) stack opcodes (GSB, RET, PSH, POP, SSZ); and (6)
  509.         the meta-interpreter opcode EXC. The SLT opcode was introduced in the
  510.         ICWS'88. Redcode warriors written for official tournaments must
  511.         obviously restrict themselves to the ICWS'88 instruction set and
  512.         addressing modes (see  6.2.). The alternate configuration file
  513.         CORESTD.SYS contains the appropriate exclude/1 statements to enforce
  514.         ICWS'88 compatibility (see  4.). In the listing below,
  515.         non-standard opcodes are indicated by a ⁿ.
  516.  
  517.  
  518.         ╔══════════════════╤═════╤═════╤════════════════════════════════════╗
  519.         ║ Instruction      │ Mnem│ Args│ Description                        ║
  520.         ╠══════════════════╪═════╪═════╪════════════════════════════════════╣
  521.         ║ Data statement   │ DAT │   B │ Non-executable; B is data value    ║
  522.         ║                  │     │     │                                    ║
  523.         ╚══════════════════╧═════╧═════╧════════════════════════════════════╝
  524.  
  525.  
  526.           Store-Instructions
  527.         ╔══════════════════╤═════╤═════╤════════════════════════════════════╗
  528.         ║ Instruction      │ Mnem│ Args│ Description                        ║
  529.         ╠══════════════════╪═════╪═════╪════════════════════════════════════╣
  530.         ║ Move             │ MOV │ A B │ Move contents of A to B            ║
  531.         ║                  │     │     │                                    ║
  532.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  533.         ║ Add              │ ADD │ A B │ Add the A- and B-fields of A to    ║
  534.         ║                  │     │     │ the A- and B-fields of B           ║
  535.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  536.         ║ Sub              │ SUB │ A B │ Subtract the A- and B-fields of A  ║
  537.         ║                  │     │     │ from the A- and B-fields of B      ║
  538.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  539.         ║ Randomⁿ          │ RND │ A B │ Generate random number (range 0 .. ║
  540.         ║                  │     │     │ A-1) and store it in B             ║
  541.         ╚══════════════════╧═════╧═════╧════════════════════════════════════╝
  542.  
  543.         ADD and SUB will add and subtract integers in the range from -32768 
  544.         to 32767. The result is normalized to the current address space.
  545.  
  546.           Branch-Instructions
  547.         ╔══════════════════╤═════╤═════╤════════════════════════════════════╗
  548.         ║ Instruction      │ Mnem│ Args│ Description                        ║
  549.         ╠══════════════════╪═════╪═════╪════════════════════════════════════╣
  550.         ║ Jump             │ JMP │ A   │ Transfer control to A              ║
  551.         ║                  │     │     │ (unconditional)                    ║
  552.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  553.         ║ Jump if zero     │ JMZ │ A B │ Transfer control to A if contents  ║
  554.         ║                  │     │     │ of B is zero                       ║
  555.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  556.         ║ Jump if not zero │ JMN │ A B │ Transfer control to A if contents  ║
  557.         ║                  │     │     │ of B is not zero                   ║
  558.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  559.         ║ Jump if greater  │ JMG │ A B │ Transfer control to A if contents  ║
  560.         ║ than zeroⁿ       │     │     │ of B is greater than zero          ║
  561.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  562.         ║ Compare          │ CMP │ A B │ If contents of A is equal to B     ║
  563.         ║                  │     │     │ then skip one instruction          ║
  564.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  565.         ║ Skip if less     │ SLT │ A B │ If contents of A is less than B    ║
  566.         ║ than             │     │     │ then skip one instruction          ║
  567.         ╚══════════════════╧═════╧═════╧════════════════════════════════════╝
  568.  
  569.  
  570.           Counter-Instructions
  571.         ╔══════════════════╤═════╤═════╤════════════════════════════════════╗
  572.         ║ Instruction      │ Mnem│ Args│ Description                        ║
  573.         ╠══════════════════╪═════╪═════╪════════════════════════════════════╣
  574.         ║ Decrement, jump  │ DJZ │ A B │ Subtract 1 from B and jump to A    ║
  575.         ║ if zeroⁿ         │     │     │ if contents of B is 0              ║
  576.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  577.         ║ Decrement, jump  │ DJN │ A B │ Subtract 1 from B and jump to A    ║
  578.         ║ if not zero      │     │     │ if contents of B is not 0          ║
  579.         ╚══════════════════╧═════╧═════╧════════════════════════════════════╝
  580.  
  581.  
  582.           Process-Instructions
  583.         ╔══════════════════╤═════╤═════╤════════════════════════════════════╗
  584.         ║ Instruction      │ Mnem│ Args│ Description                        ║
  585.         ╠══════════════════╪═════╪═════╪════════════════════════════════════╣
  586.         ║ Split            │ SPL │ A   │ Split execution into next          ║
  587.         ║                  │     │     │ instruction and A                  ║
  588.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  589.         ║ Split boundedⁿ   │ SPL │ A B │ Split, B is descendant count       ║
  590.         ║                  │     │     │                                    ║
  591.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  592.         ║ Haltⁿ            │ HLT │ -   │ Terminate execution of             ║
  593.         ║                  │     │     │ (sub)process                       ║
  594.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  595.         ║ Suspendⁿ         │ SSP │ -   │ Suspend execution of all other     ║
  596.         ║                  │     │     │ subprocesses                       ║
  597.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  598.         ║ Releaseⁿ         │ RLS │ -   │ Release suspended subprocesses     ║
  599.         ║                  │     │     │                                    ║
  600.         ╚══════════════════╧═════╧═════╧════════════════════════════════════╝
  601.  
  602.         Remarks: The two-operand version of SPL (Split bounded) implements
  603.         the descendant count modification introduced by Jon Newman (see
  604.          7.3.). The descendant_count/1 configuration predicate can be
  605.         used to enable/disable interpretation of SPLit's B-field (see
  606.          4.).
  607.  
  608.         SSP temporarily suspends executions of all threads except the one 
  609.         executing SSP. Processes remain suspended until either a RLS 
  610.         instruction is executed or the unsuspended thread(s) terminate (i.e.  
  611.         SSP, .., RLS, HLT is equivalent to SSP, .., HLT).  SSP/RLS can be 
  612.         used to bracket a "critical segment" or to preempt low-priority 
  613. V3.0=>  subprocesses. If descendant_count is enabled (see  4.), RLS
  614.         will only release those processes that were suspended by the
  615.         currently executing process. With descendant_count off, RLS releases 
  616.         all currently suspended processes. If processes are already suspended 
  617.         when a SSP is executed, the currently active processes will be 
  618.         appended to the list of suspended processes. RLS has no effect if no 
  619.         processes are suspended.
  620.  
  621.         Execution of the HLT (Halt) instruction has the same effect as
  622.         attempted execution of a data statement, except that HLT will not
  623.         trigger an error message.
  624.  
  625.  
  626.           Stack-Instructions
  627.         ╔══════════════════╤═════╤═════╤════════════════════════════════════╗
  628.         ║ Instruction      │ Mnem│ Args│ Description                        ║
  629.         ╠══════════════════╪═════╪═════╪════════════════════════════════════╣
  630.         ║ Gosubⁿ           │ GSB │ A   │ Transfer control to A; push        ║
  631.         ║                  │     │     │ current address onto stack         ║
  632.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  633.         ║ Returnⁿ          │ RET │ A   │ Pop return address from stack, add ║
  634.         ║                  │     │     │ A, and transfer control to it      ║
  635.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  636.         ║ Pushⁿ            │ PSH │ A   │ Push contents of A onto stack      ║
  637.         ║                  │     │     │                                    ║
  638.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  639.         ║ Popⁿ             │ POP │ A   │ Pop address from stack and move it ║
  640.         ║                  │     │     │ to A                               ║
  641.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  642.         ║ Stacksizeⁿ       │ SSZ │ A   │ store the number of elements       ║
  643.         ║                  │     │     │ currently on the stack in A        ║
  644.         ╚══════════════════╧═════╧═════╧════════════════════════════════════╝
  645.  
  646.         Remarks: If the descendant_count option is enabled, each process has
  647.         its own stack. If disabled, all of a program's processes access a
  648.         common stack (see  4.).
  649.  
  650.         The RET (Return) instruction needs an operand because GSB (Gosub) 
  651.         pushes a PC-relative address onto the stack.  Usually, this operand 
  652.         refers back to a label at the entry point of the subroutine ("RET
  653.         -10" for an entry point 10 addresses behind).
  654.  
  655.         PSH (Push) and POP (Pop) instructions expand or shrink the program's
  656.         private stack. The stack can hold up to 127 instructions or data
  657.         statements. Popping an empty stack, as well as pushing past 127
  658.         elements is flagged with an execution error.
  659.  
  660.  
  661.           Special Instructions
  662.         ╔══════════════════╤═════╤═════╤════════════════════════════════════╗
  663.         ║ Instruction      │ Mnem│ Args│ Description                        ║
  664.         ╠══════════════════╪═════╪═════╪════════════════════════════════════╣
  665.         ║ Protectⁿ         │ PCT │ A   │ Write-protect address A against    ║
  666.         ║                  │     │     │ next write attempt                 ║
  667.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  668.         ║ Executeⁿ         │ EXC │ A B │ Execute instruction at B, update B ║
  669.         ║                  │     │     │ & transfer control to A if no error║
  670.         ╟──────────────────┼─────┼─────┼────────────────────────────────────╢
  671.         ║ End              │ END │ A   │ Loader directive: end-of-program,  ║
  672.         ║                  │     │(Opt)│ optionally begin execution at A    ║
  673.         ╚══════════════════╧═════╧═════╧════════════════════════════════════╝
  674.  
  675.         Remarks: The END pseudo-opcode is optional and marks the end of the
  676.         program. If a program file does not contain an END statement, EOF is
  677.         assumed. The optional operand of END points to the first instruction
  678.         to be executed (e.g. END -15, if the program execution starts 15
  679.         instructions before). The default start is the first executable
  680.         instruction.
  681.  
  682.         The EXC instruction is a single-thread meta-interpreter. It provides
  683.         Redcode programs with internal exception handling, since EXC traps
  684.         errors by conditional branching: if the instruction pointed to by B
  685.         fails or is a HLT instruction, then the next instruction following
  686.         EXC is executed. If the instruction at B succeeds, then B is updated
  687.         with the new "local" program counter (the address B transfers control
  688.         to), and execution resumes at A. B is therefore usually an indirect
  689.         address. Since only one local program counter is maintained in B,
  690.         only one execution thread can be trapped by EXC.  Consequently, when
  691.         a SPL, SSP, or RLS instruction is executed by EXC, it will only
  692.         affect "global" threads. The code fragment below demonstrates a 
  693.         single-instruction meta-interpreter executing a 3-instruction 
  694.         program.
  695.  
  696.                 exc 0 @pc      ;single instruction loop
  697.                 jmp continue   ;an error was trapped
  698.         pc:     dat 1          ;local PC
  699.         loop:   mov #0 @target ;"DWARF-like"
  700.                 sub #10 2
  701.                 jmp loop
  702.         target: dat 4
  703.  
  704.         Since code executed by EXC is under control of the executing program,
  705.         it is "invisible" to the interpreter: e.g. single-step mode will not
  706.         trace the instructions under control of EXC, nor will breakpoints
  707.         trigger an interrupt. You can still debug code under the control of
  708.         EXC by placing a watchpoint on the data statement that serves as the
  709.         local program counter.
  710.  
  711.         EXCs can be nested, i.e. an EXC instruction can execute another EXC
  712.         instruction. The interpreter can catch EXC "loops", i.e. it will
  713.         signal failure if an EXC tries to execute itself in an infinite loop.
  714.  
  715.  
  716.         ┌─────────────────────────╖
  717.         │  6.2. Addressing modes  ║
  718.         ╘═════════════════════════╝
  719.  
  720.         Non-ICWS'88 modes are indicated with a ⁿ.
  721.  
  722.         ╔═════════════════════╤═══╤═════════════════════════════════════════╗
  723.         ║ Mode                │Sym│ Description                             ║
  724.         ╠═════════════════════╪═══╪═════════════════════════════════════════╣
  725.         ║ immediate           │ # │ is data value                           ║
  726.         ║                     │   │                                         ║
  727.         ║ direct              │ $ │ is effective address ($ can be omitted) ║
  728.         ║                     │   │                                         ║
  729.         ║ data-relative:      │   │                                         ║
  730.         ║       indirect      │ @ │ is address of effective address         ║
  731.         ║                     │   │ relative to data statement              ║
  732.         ║       pre-incrementⁿ│ > │ increment, is then address of effective ║
  733.         ║                     │   │ address relative to data statement      ║
  734.         ║       pre-decrement │ < │ decrement, is then address of effective ║
  735.         ║                     │   │ address relative to data statement      ║
  736.         ║ PC-relative:        │   │                                         ║
  737.         ║       indirectⁿ     │ ^ │ is address of effective address         ║
  738.         ║                     │   │ relative to program counter             ║
  739.         ║       pre-incrementⁿ│ / │ increment, is then address of effective ║
  740.         ║                     │   │ address relative to program counter     ║
  741.         ║       pre-decrementⁿ│ \ │ decrement, is then address of effective ║
  742.         ║                     │   │ address relative to program counter     ║
  743.         ╚═════════════════════╧═══╧═════════════════════════════════════════╝
  744.  
  745.         Two modes of indirect addressing are implemented: (a) data-relative,
  746.         where the effective address is calculated by adding the value of the
  747.         referenced data statement (or B-field value of an executable
  748.         instruction) to its address, and (b) PC-relative, where the value of
  749.         the referenced data statement is added to the address of the
  750.         instruction that is currently executing. Data-relative indirect
  751.         addressing is part of the original Redcode specifications introduced
  752.         by A.K.Dewdney and the ICWS'88, whereas PC-relative addressing was
  753.         mistakenly implemented as the only form of indirect addressing in
  754.         pre-V2.0 versions of CoreWar Pro. Both modes are supported in order
  755.         to maintain compatibility with both programs written for earlier
  756.         versions of CoreWar Pro, and programs that use standard data-relative
  757.         indirect addressing.
  758.  
  759.  
  760.         ┌────────────────────────────╖
  761.         │  6.3. Preprocessor syntax  ║
  762.         ╘════════════════════════════╝
  763.  
  764. V3.0=>  CoreWar Pro includes a powerful, built-in Redcode preprocessor that
  765.         facilitates writing of programs. Preprocessor features include
  766.         label-based references, constant definitions (EQUates), evaluation of
  767.         integer expressions and access to system variables.
  768.  
  769.  
  770.         ┌─────────────────────────╖
  771.         │  6.3.1. General format  ║
  772.         ╘═════════════════════════╝
  773.  
  774.         Redcode program files are relatively free-format, but you should
  775.         establish and adhere to your own format conventions for clarity. The
  776.         preprocessor is case-insensitive; empty lines are permitted.
  777.         Opcodes, labels, numbers, etc. can be separated by space(s), tab(s)
  778.         or comma(ta). Separators are not required before and after
  779.         non-alphanumeric characters. E.g.: "Choice: DJN @Start <Counter"
  780.         could be written as "Choice:DJN@Start<Counter". An exception to this
  781.         rule is the '-' (minus) character which is interpreted as the start
  782.         of a negative number in "ADD 3 -2", but as the subtraction-operator
  783.         in "ADD 3 - 2 2" or "ADD 3-2 2".
  784.  
  785.  
  786.         ┌─────────────────╖
  787.         │  6.3.2. Labels  ║
  788.         ╘═════════════════╝
  789.  
  790.         Labels are used to refer to addresses directly, rather than relative
  791. V3.0=>  to the program counter as in Plain Redcode. Labels are names that
  792.         consist of letters, numerals and the underscore and that start with a
  793.         letter or underscore.
  794.  
  795.         Every label must end with a colon, but the colon is ommitted when the
  796.         label is referenced by an instruction. Labels can be on a separate
  797.         line before or on the same line with an instruction. You can have
  798.         more than one label per instruction. E.g.:
  799.  
  800.         LastInstr:Endless: jmp endless
  801.  
  802.         is the same as
  803.  
  804.         Endless:
  805.                 jmp ENDLESS    LastInstr:
  806.  
  807.  
  808.         ┌────────────────╖
  809.         │  6.3. EQUates  ║
  810.         ╘════════════════╝
  811.  
  812.         The EQU (Equate) statement defines a name for a list of symbols used
  813.         in the following code. RPP will replace every occurence of the first
  814.         argument of EQU in the code with what follows after the first
  815.         argument. EQU is similar to the #define preprocessor directive in C.
  816.         EQUates may be nested, that is the list of symbols to be substituted
  817.         may contain other EQUated names. EQUates have the format
  818.  
  819.                 Name EQU Symbol [..]
  820.         or
  821.                 EQU Name Symbol [..]
  822.  
  823.         E.g.:
  824.                 numberlines equ (last-first+1)
  825.                 equ bombzero mov #0
  826.  
  827.         The first format is part of the ICWS'88 Redcode definition; the
  828.         second format is supported for compatibility with CoreWar Pro V2.0
  829.         and earlier. It is good practice to surround EQUated expressions with
  830.         parentheses to enforce evaluation precedence.
  831.  
  832.  
  833.         ┌───────────────────────────╖
  834.         │  6.3.4. System variables  ║
  835.         ╘═══════════════════════════╝
  836.  
  837.         By refering to system variables you can write Redcode programs that
  838.         adapt to the current system configuration. There are four system
  839.         variables:
  840.  
  841.         CORESIZE. The CORESIZE variable is instantiated to the current size
  842.         of the Core as determined by the coresize/1 predicate in the
  843.         configuration file (see  4.). The following fragment defines
  844.         the Coresize-dependent constant process_spacing:
  845.  
  846.                 equ n_processes 4
  847.                 equ process_spacing (CORESIZE / n_processes)
  848.  
  849. V3.0=>  RANDOM_ADDRESS. At load-time, the system variable RANDOM_ADDRESS is
  850.         instantiated to a random number between 0 and Coresize-1, which is
  851.         the same for each reference to RANDOM_ADDRESS within a program, but
  852.         different between programs.  RANDOM_ADDRESS can be used to create
  853.         unique "program IDs" or to add some unpredictable behavior. In the
  854.         example below, n_processes can range from 2 to 5.
  855.  
  856.                 equ n_processes (RANDOM_ADDRESS % 4 + 2)
  857.  
  858. V3.0=>  ADDRESS_SPACE. The value of ADDRESS_SPACE corresponds to the value of
  859.         the address_space/1 configuration predicate (see  4.,
  860.          7.2.).
  861.  
  862. V3.0=>  PROCESS_LIMIT. This variable is set to the value of the
  863.         process_limit/1 configuration predicate (see  4.,  7.1.).
  864.  
  865.         System variables are implemented as predefined EQUate statements and
  866.         can therefore be overridden by EQUates in the program code.
  867.  
  868.  
  869.         ┌──────────────────────╖
  870.         │  6.3.5. Expressions  ║
  871.         ╘══════════════════════╝
  872.  
  873.         Numerical expressions can be embedded anywhere in the program text.
  874.         The preprocessor evaluates an expression and substitutes it with the
  875.         integer result. Expressions consist of operators and operands.
  876.         Operators are:
  877.  
  878.                 + addition
  879.                 - subtraction
  880.                 * multiplication
  881.                 / integer division
  882.                 % modulo
  883.  
  884.         Operands can be integers, labels, expressions or symbols representing 
  885.         integers, labels or expressions. Two notations are supported: 
  886.         standard infix (A + B) and reverse-polish (A B +). You can mix infix 
  887.         and reverse-polish notation in the same expression, although this 
  888.         would not exactly add to the readability of your code.
  889.  
  890. V3.0=>  In infix notation, the order of evaluation is left to right; operator
  891.         precedence (*,/,% before +,-) is not supported, but parentheses can
  892.         be used to control evaluation order.
  893.  
  894.         Reverse-polish expressions must be enclosed in parentheses to avoid
  895.         ambiguities such as the following:
  896.  
  897.         1) ADD 2 2 - 3 => ADD (2 2 -) 3 => ADD 0 3   (reverse-polish)
  898.         2) ADD 2 2 - 3 => ADD 2 (2 - 3) => ADD 2 -1  (infix)
  899.  
  900.         Examples:
  901.  
  902.         MOV #last-first+1 numlines           ; infix
  903.  
  904.         ADD @2 * (CORESIZE + 2) counter      ; infix with parentheses
  905.  
  906.         spacing EQU (CORESIZE 4 /)           ; reverse-polish
  907.  
  908.         jmp (spacing first + - choicepoint)  ; reverse-polish, then infix
  909.  
  910.  
  911.         ┌───────────────────╖
  912.         │  6.3.6. Comments  ║
  913.         ╘═══════════════════╝
  914.  
  915.         Two comment symbols are implemented: the ; (semi-colon), which is
  916.         ICWS'88 compatible, and the REM word. REM is supported for backward
  917.         compatibility with earlier CoreWar Pro versions and may not be
  918.         supported in future versions. The comment extends from the comment
  919.         symbol to the end of the line.
  920.  
  921.  
  922.         ┌──────────────────────────────╖
  923.         │  6.3.6. Order of processing  ║
  924.         ╘══════════════════════════════╝
  925.  
  926.         The preprocessor first substitutes all EQUated names, goes on to
  927.         replace label-references by numbers, and lastly evaluates
  928.         expressions. This means that it is possible to EQUate labels.
  929.  
  930.  
  931.         ┌─────────────────────────╖
  932.         │  7. ICWS'88 extensions  ║
  933.         ╘═════════════════════════╝
  934.  
  935.         Under the current Core War standard "DWARF-like" warriors that remain
  936.         stationary and bomb the Core systematically are favored over more
  937.         "intelligent" programs that copy themselves, spawn sub-processes and
  938.         are capable of self-repair. This is evidenced by the fact that the
  939.         last freely self-replicating warrior to win the annual tournament was
  940.         MICE in 1987. Most effective warriors currently try to disable their
  941.         opponent by "process explosion", for example by planting the
  942.         devastating "SPL 0" instruction into the opponent's code. While this
  943.         is perfectly legal, it might be considered unfair, since the entire
  944.         program grinds to a halt, and not just the process whose code
  945.         segment that was hit.
  946.  
  947.         To promote more interesting warriors, Jon Newman has suggested
  948.         extensions to the current Core War standard ("Three Proposals for
  949.         future Core War standards" published in the Winter 1991 issue of The
  950.         Core War Newsletter). CoreWar Pro implements these changes while
  951.         maintaining compatibility with ICWS'88.
  952.  
  953.         ┌──────────────────────╖
  954.         │  7.1. Process limit  ║
  955.         ╘══════════════════════╝
  956.  
  957. V3.0=>  ICWS'88 does not specify a limit to the number of processes a warrior 
  958.         can spawn off. This is why "SPL 0" bombs are so effective; the 
  959.         affected warrior will stall by spawning off processes until the 
  960.         memory allocated to the interpreter is filled. CoreWar Pro allows 
  961.         defining an upper limit to the process count through the 
  962.         process_limit/1 predicate in the configuration file (see  4.).  
  963.         If the process limit is reached, SPL will not create a new process 
  964.         but will merely transfer control to the following instruction. A low
  965.         process limit will effectively defang warriors that use "process
  966.         explosion".
  967.  
  968.  
  969.         ┌──────────────────────╖
  970.         │  7.2. Address space  ║
  971.         ╘══════════════════════╝
  972.  
  973. V3.0=>  The address space extension is used to restrict the addressable range 
  974.         of Core memory. With e.g. address_space(2000) in the configuration 
  975.         file, CoreWar Pro normalizes operand values to a range of -1000 to 
  976.         999. All direct Core references are restricted to this range; 
  977.         indirect addressing accesses -2000 to 1999. This extension encourages 
  978.         mobile programs: in order to seek out opponents in non-addressable
  979.         areas of Core, warriors have to copy themselves or spawn off
  980.         processes.
  981.  
  982.  
  983.         ┌─────────────────────────╖
  984.         │  7.3. Descendant count  ║
  985.         ╘═════════════════════════╝
  986.  
  987. V3.0=>  The descendant count modification limits the number of processes that
  988.         a newly created process can spawn off. With descendant_count enabled
  989.         (see  4.), the B-operand of the SPLit instruction specifies the
  990.         maximum number of processes that the new process can create. This
  991.         limit includes children processes, children's children processes and
  992.         so on. E.g. "SPL X #0" creates a processes that cannot create
  993.         sub-processes and is therefore immune to "SPL 0" bombs (a SPLit
  994.         instruction would simply transfer control to the next instruction).
  995.         The "root" process has a descendant_count of ProcessLimit-1 (the
  996.         global processes-per-program limit set by the process_limit/1
  997.         configuration predicate). A process can change its own descendant
  998.         count by SPLitting off a sub-process with the desired descendant
  999.         count and committing suicide. You could thus write a largely "SPL 0"
  1000.         resistant program by starting the code with
  1001.  
  1002.                 spl start #some_low_number
  1003.                 hlt
  1004.         start:  <Rest of code>
  1005.  
  1006.         Additional resistance to process-explosion is conferred by the EXC
  1007.         and SSP instructions: Since EXC can only follow a single
  1008.         execution-thread, SPL executed by EXC will not create a new process.
  1009.         Frequent execution of SSP could be used defensively to inactivate
  1010.         subverted processes.
  1011.  
  1012.  
  1013.         ┌──────────────────────╖
  1014.         │  8. The Core Editor  ║
  1015.         ╘══════════════════════╝
  1016.  
  1017.         The Core Editor is a debugging tool for inspecting and modifying the
  1018.         contents of the Core array. Invoked from the Monitor menu, the Core
  1019.         Editor opens a window centered on the Core address that was executed
  1020.         last. Each address is displayed as one line with the format:
  1021.  
  1022.         Address Attr Instruction
  1023.          3017  1W    CMP #513 @-12
  1024.  
  1025.         "Address" is in the range from 0 to CoreSize-1. The attribute
  1026. V3.0=>  consists of a number which may be followed by a "W", "B", or "P".
  1027.         The number is the "owner" attribute of this address and corresponds
  1028.         to the number of the program that wrote to it last. The "W" indicates
  1029.         that this address is marked as a watchpoint to be displayed when the
  1030.         watchpoint switch is enabled on the control panel (see  9.).
  1031.         Similarly, the "B" marks an address as a breakpoint. An address is
  1032.         protected against the next write access if the "W" symbol is
  1033.         displayed. The contents of the instruction field is displayed as
  1034.         "Plain Redcode", i.e. with labels, expressions and symbols resolved
  1035.         to numbers. "Empty" addresses are shown with blank attribute and
  1036.         instruction fields.
  1037.  
  1038.         A selection bar highlights the current address. You can move around
  1039.         the Core using cursor-control keys and issue single-character
  1040.         commands displayed on the status line:
  1041.  
  1042.                 Up-, Down-Arrow         move selection bar up or down by
  1043.                                         one address
  1044.                 Left-, Right-Arrow      scroll screen up or down by one
  1045.                                         address
  1046.                 <PgDn>, <PgUp>          display next or previous screen (22
  1047.                                         addresses)
  1048.                 <^PgDn>, <^PgUp>        (Control-PgUp, -PgDn) jump 1/8th of
  1049.                                         the Core size ahead or back
  1050.                 <Home>                  go to the top of the page
  1051.                 <End>                   go to the bottom of the page
  1052.                 <Del>                   Erase contents of current address
  1053.                 <G>oto                  go to specified address
  1054.                                         (default is the current address
  1055.                                         offset by the B-field of the current
  1056.                                         address, i.e. a JMP @0 #Goto)
  1057.                 <E>dit                  edit current address
  1058.                 <F>ind                  find contents of address
  1059.                 <P>rot                  write-protect/deprotect current
  1060.                                         address (equivalent to executing PCT
  1061.                                         on this address/writing to it)
  1062.                 <B>reak                 toggle breakpoint flag
  1063.                 <W>atch                 toggle watchpoint flag
  1064.                 e<X>ec                  execute current address and move
  1065.                                         selection bar to next PC
  1066.                 <Esc>                   return to Monitor menu
  1067.  
  1068.         The <E>dit  command allows you to change the instruction field of the
  1069. V3.0=>  current address. The full preprocessor syntax is supported at the
  1070.         prompt for a new instruction. This means that labels, expressions and
  1071.         system variables can occur in the instruction. You can even key in an 
  1072.         EQUate statement, in which case the old instruction is not 
  1073.         overwritten. Labels and EQUated symbols remain valid for the current 
  1074.         editing session and are cleared upon exiting the Core Editor.
  1075.  
  1076.         <F>ind prompts for an instruction to search for. Again, this
  1077. V3.0=>  instruction may contain labels, expressions, etc.. If you hit <Enter>
  1078.         at the prompt, the Editor will search for the next occurrence of the
  1079.         instruction field of the currently selected address. The address
  1080.         attribute is ignored in the search. The search instruction may be
  1081.         specified incompletely using the * wildcard. The * can take the place
  1082.         of the opcode, the A- and the B-field. E.g. "MOV * *" positions the
  1083.         selection bar at the next MOV instruction, irrespective of operands.
  1084.         "* 0 1" searches for any opcode with operands 0 1, "* * *" jumps to
  1085.         the next non-empty address, and "* *" locates the next instruction
  1086.         with an empty B-field.
  1087.  
  1088.         The e<X>ecute command will try to execute the instruction currently
  1089.         under the selection bar. If the address is executable, the screen is
  1090.         refreshed to show updated Core addresses, and the selection bar moves
  1091.         to the address that the executed instruction transfers control to. If
  1092.         an executed instruction returns more than one new process counter -
  1093.         as it is the case with SPL and RLS - only the first PC is traced.
  1094.         This command is extremely useful for debugging code segments. In
  1095.         conjunction with the <E>dit command, you can write write entire
  1096.         programs into the Core and watch them execute.
  1097.  
  1098.  
  1099.         ┌───────────────────────────╖
  1100.         │  9. Run control switches  ║
  1101.         ╘═══════════════════════════╝
  1102.  
  1103.         The run control panel in the Monitor module has nine on/off switches
  1104.         that control appearance and interrupt behavior of a Core War battle.
  1105.         Three parameters control how the battle is represented on screen
  1106.         (single step, visual, watch), the remaining six control under what
  1107.         circumstances execution is paused.
  1108.  
  1109.         Key interrupt   ON: execution can be paused at any time by
  1110.                         pressing any key, OFF: execution can only be
  1111.                         interrupted by pressing Control-Break (usually
  1112.                         ON, except when "single step" is enabled).
  1113.                         Default: ON
  1114.  
  1115.         Single step     ON: trace mode for debugging, the instruction
  1116.                         executed is displayed in the main window in Core
  1117.                         Editor format (see $editp$.). Single step ON disables
  1118.                         all other switches (except Watch), since in this mode
  1119.                         execution is interrupted after each instruction
  1120.                         anyway.
  1121.                         Default: OFF
  1122.  
  1123.         Visual          ON: visual representation of Core War execution is
  1124.                         enabled. In visual mode, the Core is mapped to the
  1125.                         main window, with each address corresponding to one
  1126.                         position on the 22 * 78 character area (increasing
  1127.                         address from left to right, top to bottom). If the
  1128.                         Core size exceeds 22 * 78 = 1716 then adjacent Core
  1129.                         addresses may map to the same cursor position,
  1130.                         "condensing" the entire Core onto one screen.
  1131.                         Execution of a process is shown by writing its
  1132.                         identifying character and color to the main window at
  1133.                         coordinates corresponding to the current program
  1134.                         counter. Writing to Core addresses is indicated by a
  1135.                         different character and color (all program display
  1136.                         parameters can be customized by prodisplay/9 in
  1137.                         the configuration file, see  4).
  1138.                         Default: ON
  1139.  
  1140.         Watch           ON: the contents of addresses marked as watchpoints
  1141.                         (using <W> in the Core Editor) are displayed while
  1142.                         programs are running. The contents of the instruction
  1143.                         it points to as an indirect address is also displayed
  1144.                         on the same line. Besides watchpoints, the current
  1145.                         list of program counters and the contents of the
  1146.                         private stack are shown. OFF: no watch-information is
  1147.                         displayed. "Watch" is compatible with all other
  1148.                         execution views, although it is most commonly used
  1149.                         together with "Single step".
  1150.                         Default: OFF
  1151.  
  1152.         Breakpoints     ON: the scheduler pauses after an instruction at a
  1153.                         breakpoint address was executed (Address Mode =
  1154.                         4,5,6,7); OFF: although a breakpoint may have been
  1155.                         reached, execution is not interrupted. Breakpoints
  1156.                         can be marked from within the Core Editor.
  1157.                         Default: ON
  1158.  
  1159.         Break on error  ON: interrupt is invoked if an instruction cannot be
  1160.                         executed (e.g. a data statement), usually indicating
  1161.                         that the faulting process has been corrupted by a
  1162.                         contestant destructively modifying its code in Core.
  1163.                         OFF: execution continues through errors. The Monitor
  1164.                         terminates a faulting process. If a program has only
  1165.                         one process running (and no processes were suspended
  1166.                         by SSP), an execution error will terminate the
  1167.                         program.
  1168.                         Default: ON
  1169.  
  1170. V3.0=>  Break on execute opponent
  1171.                         Each Core address has an "owner attribute", a 4-bit
  1172.                         field indicating which program has last modified it.
  1173.                         The contents of this flag is shown in the second
  1174.                         column of the Core Editor display (see  8.).
  1175.                         ON: the Monitor uses this information to generate an
  1176.                         interrupt if a program executes an instruction that
  1177.                         was last written to by a different program. This 
  1178.                         interrupt thus signals imminent program failure.  
  1179.                         Default: ON
  1180.  
  1181. V3.0=>  Break on overwrite opponent
  1182.                         ON: An interrupt is generated if a program writes to
  1183.                         an address that has previously been modified by a
  1184.                         different program. This tends to signal program
  1185.                         failure earlier than "Break on execute opponent", but
  1186.                         also pauses at less critical events, such as one
  1187.                         program's bombs overwriting another program's bombs.
  1188.                         Default: OFF
  1189.  
  1190.         Count-down from <Count>
  1191.                         ON: the count-down counter is decremented with each
  1192.                         excution of an instruction. If zero is reached,
  1193.                         execution is interrupted, but may be restarted since
  1194.                         the counter is automatically reset. The current count
  1195.                         is also displayed on the status line during a battle.
  1196.                         Default: OFF
  1197.  
  1198.  
  1199.         ┌───────────╖
  1200.         │ 10. Bugs  ║
  1201.         ╘═══════════╝
  1202.  
  1203.         The program is very sensitive to format errors in the configuration
  1204.         file, e.g. the SideKick Notepad appends a ^Z character to each file
  1205.         edited, which causes CoreWar Pro to report an error upon start-up.
  1206.         Most other ASCII-editors should work fine.
  1207.  
  1208. V3.0=>  While there is no fixed limit on the number of Redcode programs that
  1209.         can be run concurrently, program numbers greater than 31 will carry
  1210.         from the "owner" field into first the breakpoint- and then the
  1211.         protect status bit of address attributes. Consequently, programs with
  1212.         program numbers greater than 31 will trigger false breakpoint
  1213.         interrupts (unless turned off from the control panel). Programs above
  1214.         63 will have all their instructions write-protected which is usually
  1215.         undesirable.
  1216.  
  1217.  
  1218.         ┌──────────────────────╖
  1219.         │ 11. Version history  ║
  1220.         ╘══════════════════════╝
  1221.  
  1222.         V1.0 to 1.5 (July-September 1988, not released)
  1223.  
  1224.         V1.6 (released April 1989)
  1225.                 ■ representation of Core as dynamic database predicates
  1226.                 ■ color support
  1227.  
  1228.         V1.7 (released November 1990)
  1229.                 ■ Redcode preprocessor
  1230.                 ■ condensed visual display of execution
  1231.                 ■ stack opcodes
  1232.  
  1233.         V2.0 (released March 1991, posted on c.b.i.p April 1)
  1234.                 ■ more opcodes
  1235.                 ■ Core editor
  1236.                 ■ watchpoints
  1237.                 ■ internal representation of instructions hidden
  1238.  
  1239.         V2.1 (released August 1991)
  1240.                 ■ ICWS'88 compliant
  1241.                 ■ larger Core sizes
  1242.                 ■ lower memory requirement
  1243.  
  1244.         V3.0 (released November 1991)
  1245.                 ■ faster execution
  1246.                 ■ integration of preprocessor
  1247.                 ■ EGA/VGA extended textmodes
  1248.                 ■ ICWS'88 extensions
  1249.  
  1250. End of COREMAN.DOC, date of last change: 11-17-91
  1251.